package org.gwt.pluginframework.development.client;

import org.gwt.pluginframework.common.Plugin;
import org.gwt.pluginframework.common.event.IPluginEvent;
import org.gwt.pluginframework.common.event.PluginEventHandler;

import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;

public class PluginExample extends Plugin {

	private static final long serialVersionUID = 8090141308808542813L;
	
	private ContentPanel panel = new ContentPanel();
	
	public void setupManifest() {
		manifest.setName("PluginExample");
	}
	
	@Override
	public void onInitialize() {
		panel.add(new Label("Sample Plugin!"));
		panel.add(new TextBox());
		panel.add(new CheckBox());
	
		registerEventHandler(new PluginEventHandler("myTestEvent") {
			public void handle(IPluginEvent event) {
				MessageBox.info("Event", "I've got myTestEvent :)", null);
			}
		});
	
		registerEventHandler(new PluginEventHandler("my") {
			public void handle(IPluginEvent event) {
				MessageBox.info("Event", "I've got my :)", null);
			}
		});
	}
	
	@Override
	public void onStart() {
		MessageBox.alert("Message", "Wassup", null);
	}

	public ContentPanel getPanel() {
		return panel;
	}
}
